﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace NHTrace
{
  public class IESoundDisabler
  {
    [DllImport("urlmon.dll")]
    [PreserveSig]
    [return: MarshalAs(UnmanagedType.Error)]
    static extern int CoInternetSetFeatureEnabled(
    int FeatureEntry,
    [MarshalAs(UnmanagedType.U4)] int dwFlags,
    bool fEnable);

    private const int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
    private const int SET_FEATURE_ON_PROCESS = 0x00000002;

    public static void DisableSounds()
    {
      int feature = FEATURE_DISABLE_NAVIGATION_SOUNDS;
      CoInternetSetFeatureEnabled(feature, SET_FEATURE_ON_PROCESS, true);
    }
  }
}
